﻿#region imports

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using CondeNet.AssetManager.Data;
using CondeNet.AssetManager.Business;
using CondeNet.AssetManager.Business.Interface;

#endregion

namespace CondeNet.AssetManager.DataProvider.Sql.Mappers
{
    public static class MimeTypeMapper
    {
        internal static IMimeType ToBusinessObject ( T_MimeType entity )
        {
            return new MimeType (
                entity.MimeType_IDPK ,
                entity.Name_NVC ,
                entity.Description_NVC ,
                entity.Enabled_BIT ,
                entity.MimeType_NVC );
        }

        internal static T_MimeType ToEntity ( IMimeType v )
        {
            T_MimeType entity = new T_MimeType ( );

            entity.MimeType_IDPK = v.ID;
            entity.Name_NVC = v.Name;
            entity.Description_NVC = v.Description;
            entity.Enabled_BIT = v.Enabled;
            entity.MimeType_NVC = v._MimeType;

            return entity;
        }

        internal static IList<IMimeType> ToBusinessObjects ( IList<T_MimeType> dalList )
        {
            return dalList.Select ( tmp => ToBusinessObject ( tmp ) ).ToList ( );
        }

        internal static IList<T_MimeType> ToEntities ( IList<IMimeType> entityList )
        {
            return entityList.Select ( tmp => ToEntity ( tmp ) ).ToList ( );
        }
    }
}
